//
//  LGNavigationController.m
//  微博oc版
//
//  Created by Apple_Lzzy27 on 16/10/10.
//  Copyright © 2016年 Apple_Lzzy27. All rights reserved.
//

#import "LGNavigationController.h"
#import "UIBarButtonItem+LGBarButtonItem.h"
#import "LGBaisController.h"
@interface LGNavigationController ()<UINavigationControllerDelegate>

@end

@implementation LGNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.delegate = self;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
   

    
    //设置全站返回按钮
    if(self.childViewControllers.count > 0){
        viewController.hidesBottomBarWhenPushed = YES;
   
    if ([viewController isKindOfClass:[LGBaisController class]]) {
        
     LGBaisController *vc = (LGBaisController *)viewController;
    
    if (self.childViewControllers.count == 1) {
        
        vc.navItem.leftBarButtonItem = [UIBarButtonItem BarButtonCustButton:self.navigationItem.title fontSize:14 addTarget:self action:@selector(back) isBack:YES];
    }else{
       
        
        vc.navItem.leftBarButtonItem = [UIBarButtonItem BarButtonCustButton:@"返回" fontSize:14 addTarget:self action:@selector(back) isBack:YES];
        

    }
   }
     }
    [super pushViewController:viewController animated:animated];
    

}

- (void)back{
    
    [self popViewControllerAnimated:YES];
    
}

@end
